﻿using MediatR;
using T_Rbac.Read.APi.Application.Command.Rules;
using T_Rbac_Demain;
using T_Rbac_Rep.Interface;

namespace T_Rbac.Read.APi.Application.Handlers.RulesHandlers
{
    public class RuleFindHandler:IRequestHandler<RulesFindCommand,Rule>
    {
        private readonly IRuleInformation ruleInformation;

        public RuleFindHandler(IRuleInformation ruleInformation)
        {
            this.ruleInformation = ruleInformation;
        }

        public async Task<Rule> Handle(RulesFindCommand request, CancellationToken cancellationToken)
        {
            var list = await ruleInformation.GetAloneByid(request.id);
            return await Task.FromResult(list);
        }
    }
}
